Stored the whole HD directory tree as a file and loaded it each time it was
run. To update the tree, had to delete the file and run again. A bit crap,
but I used it every day for months, and it saved a lot of time!
1.00 May 1993
Having seen !QuickDir by Clive Jones, I decided to provide menu-making on the
fly as well, so the menu tree was always up-to-date. Also converted to
DeskLib, which is superb. Added the configuable root menu featue.
1.10 May 5 1993
Now displays icons in the menus. Discovered that the Wimp sends a message
with action code 0x400c9 when a menu is removed without a selection being
made (e.g. a click off the menu). This is used to release all claims on
further messages, which are detected when the menu is open in order to create
new sub-menus when MENU_WARNING messages are sent by the WIMP.
1.20 May 12 1993 ** First release **
Added the Info/Quit menu. The Info box is my first ever dialogue box, and I
don't know how to make it moveable like all other dialogue boxes I've seen.
1.21 May 24 1993
Added the options to open the root menu on the left hand side of the screen,
as suggested by Kai Schlichting. Fixed a minor bug which resulted in a
garbled title bar of the submenu of a '@' root item. I've now read the
comp.sys.acorn Application Writer's Guide, so there is now no !Boot file, and
I've found out how to make the Info window movable (process event_OPEN
events).
1.30 ** Second release **
Added Help to normal menu. Added 'Edit Configs' and 'Update' to normal menu.
These do a poor-man's implementation of a proper dialogue-box configuration
setter/saver. If I had more time... Actually, you shouldn't want to change
the configs very often, so this method isn't too bad. Changed the template
file so that the program fills in the version/date when it is run.
1.31
Looks for File_0fb instead of File_fb, when searching for a file-type
sprite when the file-type is < &100.
1.32
Compiled without function names in code, to make it slightly smaller.
1.40 20 June 1993
Can have multiple icons on the icon-bar, with independent root menus.
1.41
Can have text under the icons.
1.42 28 June 1993
If a directory has bit 6 of its Access atributes set, !DirMenu now displays
it as an application (i.e. looks for a wimp sprite with same name). This is
for compatability with FilerPatch, by Jens Ovesen.
1.43 4 July 1993
The WIMP doesn't seem to invert text+sprite icons in the same way as normal
icons in menus, so I've padded all items with spaces, making highlighted
icons in the menu easier to see.
2.00 11 July 1993
Now creates a menu for Filer windows, like !QuickDir. This is done by
attaching a filter to the Filer which sends !DirMenu an event_CLICK when
<Alt>-Menu is clicked on a filer window.
2.10 13 July 1993
Opens a menu when there is a menu-click on the filer window title bar. I
think this is a lot more convenient than going to the keyboard to press
<Alt>. Couldn't use a filter for this because menu-clicks on title bars don't
seem to be passed on to apps by the Wimp. Hence had to make a module which
claims OS (not Wimp) mouse button events, and sends event_CLICK's to DirMenu.
2.11 13 July 1993
Opens a Filer-window menu for both cases - menu on title bar, and
<Alt>-Menu on workarea. !MakeMod makes a single module which acts as a
filter on the Filer, and also catches mouse events. I Couldn't use
mouse-event-detector for the <Alt>-Menu case because the filer would
flash open its menu just before DirMenu opens its menu. !RunImage runs
the Basic prog '!MakeMod' after it has initialised as a task. !MakeMod
then assembles the module, called DirMenuMouse, assembling in the Filer
and DirMenu task_handles. When DirMenu is quit, it RMKill's the module.
Assembling a module every time DirMenu is run is a bit clumsy, but I am
a new-comer to ARM assembler, so a module that actively finds the
relevant task handles (like in !QuickDir) is a bit too advanced for me.
My method makes for a smaller module anyway, and anyway Acorn have gone
to the trouble of including an assembler on every machine, so I might as
well take advantage of it! I don't know of any way of preventing the
Wimp from seeing a mouse click. This caused a few problems when making
DirMenu respond to non-Wimp events from the module. Any suggestions ?
2.20 14 July 1993
Uses a simple Wimp_Poll loop instead of DeskLib's Event_ functions, which are
a bit of a luxury in such a simple program. This makes !RunImage nearly 5k
smaller. However, it still can't fit into a 32k wimpslot.
2.21 18 July 1993 *** third release ***
Can set DirMenu to expand all system variables in file-paths prior to
Filer_Run-ing them. This is for when iconbar icons are specified to use
system variables such as <Wimp$ScrapDir> or @. It makes file/application
windows contain the full path name of the files that are clicked on. This
just uses SWI "OS_FSControl" with r0=37.
2.22 27 July 1993
Oh dear! The click-on-Filer-titlebar thing seems to be a bit wobbly. Changes:
1. Detects true menu button click i.e. buttons 000 -> 010, rather than
xxx -> y1y.
2. When opening a Filer-window menu, the main program now rechecks that
the pointer is over a titlebar, as a drag closely followed by a menu
click on a workarea seem to result in Wimp_GetPointerInfo returning
the poition of the start of the drag i.e. a titlebar. This resulted
in spurious menu opening sometimes. Unfortunately, if you now move
the pointer away from a titlebar very quickly after clicking menu,
this modification may mean that DirMenu won't open a menu.
3. In !MakeMod, changed SWI calls to have 'X' bit set, and return if the
SWI signals an error. The normal OS default error handling can give a
horrid crash when using MemFS's non-multitasking 'free' window. I
don't think this is my fault, as the OS error handling should cope
with errors, and the SWI was Wimp_GetPointerInfo - hardly a
complicated system-altering one. There was no problem with other
non-multitasking windows.
Thanks to Kai Schlichting for noticing these problems.
2.23 13 Aug 1993 *** fourth release ***
Mr Schlichting still gets spurious menus, and I'm a bit stumped by them. I
think part of the the problem is something to do with Wimp_GetPointerInfo
returning an out-of-date old mouse position just after a drag has taken
place, leading to DirMenu being told that a click occured on a title bar,
when it didn't. You can now make DirMenu only respond to <Alt>-Menu
clicks in a filer window, by altering 'Configs'. This removes the
low-level code from DirMenu's module. The two tiny Obey files 'TBar' and
'NoTBar' are needed because Filer_Run doesn't allow you to send
parameters to whatever it is you're Filer_Run-ing.
2.24 16 Aug 1993
Copes with different Access bit used by Filer+ 1.13. Doesn't search for
#<spritename> etc yet.
2.25 5 Sep 1993
A few small improvements:
1. Treats image filesystems as directories, allowing you to look inside
them, assuming ArcFS (or similar) is running. The old read-only ArcFS
didn't support this, so I couldn't do it until now.
2. Now shows correct Filer+ sprites in the top half of the Filer-window
menu.
3. Objects which are hidden by Filer+ ( because bit 6 of attributes is
set) are displayed with fainter text, but are still
selectable.
2.30 6 Sep 1993
Displays sprites like #<name> etc. for directories, applications and images,
according to the precedence rules used by Jens Ovesen's Filer+ 1.14.
2.40 20 Sep 1993
Responds to Menu clicks on any window, such as an !Edit or !Paint window.
DirMenu uses Wimp_TransferBlock to read the (indirected) title of the window,
as it will typically be stored in another applications workspace. If the
initial part of the window title is a filename (i.e. most of the time),
DirMenu will display the contents of the directory belonging to the file,
otherwise it will be a directory, so DirMenu will display the contents of
this directory. If the window contains more than about 100 icons, DirMenu
will crash. This is because the SWI which finds the title of a window
(Wimp_GetWindowInfo) also returns all the icons in the window, and there is
no way of telling how many of these there are so you can't garantee there
will be enough space reserved... It seems crazy to me that there isn't an SWI
which returns a window's info *without* its icons. Please let me know if
there is (a RISC OS 3?) one that I haven't heard of.
Another problem occurs when Menu is clicked on the title of a Zap window. Zap
seems to store only the visible part of the window title, in order to
implement custom justification where the leaf of the path is always visible.
This means that DirMenu will sometimes only get part of the path when Menu is
clicked on a Zap window.
As usual, you can alter Configs so that these clicks are ignored, if you find
these bugs a problem. On the other hand, if you know of any solutions to
them, please tell me!
I've got rid of the Obey files 'TBar' and 'NoTBar', because there are now
too many options to send to the Module-maker !MakeMod. I now use the system
variable 'DirMenu$Options' to pass the parameters to !MakeMod.
2.41 22 Sep 1993
OS_File (with r0 = 5) should return 0 in r0 if a file doesn't exist, but
sometimes it just gives an SWI error, so DirMenu now looks at the SWI error
flag before accepting a window title as a valid pathname. Previously,
Menu-clicking on a Zap window could make DirMenu open stupid menus. Also
explicitly closes any existing menu, using Wimp_CreateMenu with r1=-1, when a
title-bar click is detected, instead of waiting for the Wimp to do it. I
thought this might save a little time on slow machines.
2.42 29 Oct 1993
DirMenu quits with an error message if it finds it has tried to get title of
a window with more than 100 icons. This is because some of DirMenu's memory
will certainly have been overwritten, and this could have unpleasant
consequences if ignored.
2.50 29 Oct 1993
Can have a 'Set CSD' item in a window menu
2.51 31 Oct 1993
Can force a 'Set CSD' item to appear by holding down <Shift> while Menu
clicking on the titlebar of a window.
2.52 11 Nov 1993
Uses modified RO3 version of Wimp_GetWindowInfo, which ignores any icons in
the window. Hence DirMenu doesn't quit if you click on a window with > 100
icons. Thanks to Clive Jones and Erik de Kort for telling me about this. (the
trick is to set bit 0 of R1 when calling Wimp_GetWindowInfo. R1 points to the
block of memory reserved for the window information, which is word aligned so
the bottom 2 bits are unused). Also stopped the closing of existing menus
(see v. 2.41) as I think this was giving strange 'Unknown OS_Module call'
errors.
2.53 18 Jan 1994
Improved the error handling when an item in an icon-bar menu was incorrectly
specified as (for e.g.) "DeskLib: *" instead of "DeskLib:*"
2.60 2 Feb 1994
Tidied up the code generaly.
Called 'TreeMenu' now. Albert Koelmans at the newcastle server stored it
under this name, and it sounds better that 'Dir(e) menu'!
I tried to make the menus auto-scrolling, but failed miserably -Menus behave
like normal windows, but don't seem to respond to wimp messages. Also, they
don't seem to have a valid taskhandle
Changed to the format of the 'Configs' file, so that the help comments don't
take up so much space, and renamed it '!Configs'.
2.62 14 Feb 1994
I've just bought the PRM's 8) and found that when you have finished claiming
an event, you should call OS_Byte 13, *then* OS_Release. (I used to do it the
other way round.
Added the 'reverse mouse button' option, and the 'Set CSD with <Alt>. These
were both requested by Dennis Howe ages ago, but I've only just got round to
them.
!TreeMenu now tells you if an error occurred from the 'Filer_Run ...' or
'Dir ...' command. This is useful if you try to set the CSD to a file.
2.70 21 Feb 1994
Finally managed to make the menus auto-scrolling.
The WIMP seems to use OS_Mouse to read the pointer position/button state,
so I tried intercepting this SWI, and returning a bogus click. This worked,
but requires a separate module with a SWI, and would involve coding a
buffer in order to fake button press + buton release. The solution I now
use is to add mouse events into OS_Mouse's buffer, using OS_Byte 138. The
PRM's say this isn't recommended, but if you must do this, you should
disable events while you are writing to the buffer (which I do), in case
a real mouse event (e.g. the user clicking) arrives when you are in the
middle of adding bytes to the buffer. I'm not quite sure why this is not
reccomended, and I'm fairly certain there isn't a cleaner way. Anyway,
it all seems to work OK. The scrolling isn't very smooth, and has only 2
speeds, but is still very useful.
2.80 22-Jun-1994
Cleaned up code a bit.
Changed !MakeMod and TreeMenu so that adjust-clicks on disc icons are
detected and open up a menu. This only works for ADFS disc at the mo.
2.90 23-Jun-1994
Now detects Adjust clicks on pinboard. Adjust clicks on icons are
ignored so that so can still select/deselect pinboard icons.
Adjust-Dragging on the pinboard is a little tricky, because TreeMenu
opens up a menu, but Esc gets rid of it.
2.91 23-Jun-1994
Got rid of some of the separaters in menus - these make some menus a bit
big. Only items which include the first level contents have separaters
above and below.
3.00 24-Jun-1994
Should handle SCSI, ADFS and IDEFS disc drives now (I've only got ADFS
so can't check the others.). You can choose whether to look at disc
drives or the pinboard now.
Cleaned up TreeMenuMouse a bit. It now puts some extra info in word 5 of
the event_CLICK pollblock, which tells the main program what sort of
click it is - window titlebar, Pinboard, Filer-<Alt>-click, ADFS disc,
SCSI disc, IDE disc, etc. Previously, the main application looked at
what application was under the pointer, which part of the window the
pointer was over etc, which got a bit messy when clicks started coming
from disc icons and the pinboard.
Got rid of the option to only make titlebar menus for Filer windows.
This was only there because of the problem of getting window info
without info on the window icons, which was cured ages ago.
3.01 24-Jun-1994
<Alt>-Adjust clicks on pinboard are detected even if they are over an
icon.
3.10 05 Jul 1994
Handles directories with arbitary number of files - not limited to 77
files per directory. Done this by using OS_GBPB r0=9 to find space
required for the filenames, then using this to calculate buffer size
needed for OS_GBPB r0=10.
Discovered that !ArcFS needs some extra buffer-space when asked to
return the contents of an archive directory, so have added 256 bytes to
the calculated buffer size.
Made TreeMenu sort directory contents by name when the filing system is
'NFS::', as unix systems via NFS gives unsorted directory contents.
3.20 06 Jul 1994
Can go deeper than 8 menus. When the 8th submenu is opened, it is
coloured differently. If you move to a submenu from the 8th menu, a
completely new menu is created, which is similar to the menu created
when you click on a titlebar.
3.21 06 Jul 1994
Can turn off FilerPatch compatibility.
3.22 07 Jul 1994
When a menu is opened by clicking on an editor-window's titlebar, the
item in the directory corresponding to the editor-window is coloured
red, so you know which one it is.
Changed !MakeMod so that all filter code preserves r0-r12. Previously,
only r0-r1 were preserved. Someone was having problems with !DeskTop+,
where outline-font file icons weren't redrawn properly when
adjust-clicked. !MakeMod corrupted r2 in this case, which might be the
cause... Anyway, the PRMs say filter code should preserve all registers.
3.23 13 Jul 1994
Fixed a bug in the SCSIFS/IDEFS part, and added support for CDROM.
3.24 16 Jul 1994
Changed SCSIFS: to SCSI: when pathnames are formed after a click on a
SCSI drive.
Made the drive-adjustclick work even if the drive icon's text isn't
indirected.
If a discname gives an error from OS_GBPB, the error message is put into
a faded menu item, instead of just 'Error'. e.g. this gives a menu with
the single faded item 'Drive empty' if you click on the floppy icon
while no disc is present.
Made titlebar menus open the standard 64 pixels to the left, instead of
128 (yep, 128 = 64+64 ...).
Mostly cured the problem where a normal window could jump across the
screen when (for e.g.) Menu on a full-size text window, then Select
click on the same window's title bar. This was caused by TreeMenu
thinking the normal window was a menu window, and sending it clicks etc.
The problem is not 100% cured as it is difficult to tell for sure
whether a window is a menu window. I check for lots of flags including
vscroll and no hscroll and no size icon, which should cope most of the
time.
3.30 17 Jul 1994
Paths like 'System:' or 'Run:' are expanded into <System$Path> etc, and
the separate elements of these comma-separated lists of paths are all
displayed, separated by menu-separators. Hence if you put 'System:', you
can look at the whole system path, rather than just the first one. The
paths are also dealt with recursively, so that if System$Path =
'System_Real:', then System_Real$Path is expanded.
Actually, this doesn't work correctly...
Opens hourglass when making menu for a directory.
3.31 17 Jul 1994
Added option to sort any directories which have any item with name
longer than 10 chrs. This is to aid use with !LongFiles, which allows
long filenames, but results in badly-sorted directory lists (because
the longfiles are actually stored using a standard name+number. Also
made NFS sorting optional.
Made the sorting case-insensitive.
3.32 19 Jul 1994
Changed !MakeMod so that the task name of the CD filing system is
'CDFS Filer'.
4.00 07 Aug 1994
Functionally pretty much the same as the last version, but radically
rewritten, hence the version number.
Main reason for changes is to prepare for converting TreeMenu into a
module which can make treemenus for any application via a SWI interface,
make the memory allocation more efficient, and deal with ...$Path
variables properly.
Allocates memory in a more efficient way which copes a lot better with
large menus which contain more than one directory's contents. I've
also written my own small routine to load the Info window from the
template, which saves a few k compared to using DeskLib's Window_Create.
Added another option to path specifications in 'Choices': if you append
a '#' to an item in 'Choices' (&| a '*'), the elements of the parent
path will be displayed on separate lines, as in titlebar menus. If you
don't append a '#', the display is as before, with one long line.
Internally, TreeMenu uses the '#' to open a titlebar menu, rather than
having special code.
Displays multiple paths correctly now, such as 'system:'. If you append
a '*' or '#' to an item like 'System:', these will effect the
first submenu which has the multiple directories in 'System$Path',
rather than the inital item, which will always be un-expanded if it is a
...$Path varible. Coping with ...$Path was difficult!
Slightly changed the format of !Configs, and renamed to 'Choices' to
conform to the Acorn Style Guide.
Titlebar menus are much better behaved now - before, they wouldn't open
if a treemenu was already open for example. I now open titlebar menus in
response to menu button *release*, to avoid conflicts with the wimp.
Fixed a bug which sometimes used the wrong sprite for archives.
Removed the option to reverse Menu and Select clicks on TreeMenu iconbar
menus.
Uses a 'small_disc' sprite for root parent items, and a small-ed 'cd'
sprite for CDFS:: items. I've put 'small_disc' into !Sprites(22), which
isn't really PC as it gets loaded into the wimp sprite area, but is a
lot simpler than creating my own sprite area for one sprite. NB using
the existing 'harddisc' small-ed doesn't work very well as it is too
wide.
Things not implemented yet: 'Set CSD' item in titlebar menus. Alt-select
still selects the CSD, so this option is less needed.
Changed all path arrays to be 256 chrs long, rather than 80
(FILENAME_MAX in Desktop C's <stdio.h> is 80). Also checks that paths
don't go over this limit.
4.10 13 Aug 1994
Improved the code to make it find directory contents faster and reduce
code size. The old method rather stupidly called OS_GBPB twice, once for
the item names, once for the types 'cos of the memory saving I needed to
do to stop the wimpslot going to 96k for things like Run:*#. Found a way
of avoiding this.
Got rid of the option to not pad menu items. Items are always padded.
Holding down <Shift> while making a new submenu makes a completely new menu.
Holding down <Ctrl> while making a new submenu makes a submenu without
any sprites. This is slightly faster.
Made TreeMenu store the last filetype spritename, and checks whether a
file is the same type as the last file displayed. If so, don't need to
check the sprite exists etc, just use the same name as before. This has
a noticable speed increase when opening directorys full of one sort of
file, which is quite a common occurrence.
version 4.10 opens my Run:*# in ~2.15 sec, version 4.00 took around 2.55
sec.
Resources:$ is stupid! OS_GBPB returns offset=-1 when you've got all
items in a directory, but never does this for resource:$ the first time
you call it. Hence you always have to call it at least 2 times, which is
really slow - the second time seems to be just as slow as the first
time. Have got around this by assuming all the dir has been received if
there are more than 256 bytes left in the buffer sent to OS_GBPB. This
makes things a bit faster when looking in Resources:$
The module ImageFSFix interacts with FilerPatch to stop OS_GBPB behaving
properly - e.g. not returning an error for non-existent directories
(this used to crash TreeMenu, as it would think there were 4096 items to
deal with when the buffer was in fact empty). Have detected these
situations and made TreeMenu show a faded 'OS_GBPB problem' for these
menu items.
4.11 17 Aug 1994
Changed Templates so that the infowindow doesn't return clicks.
Looks for small_xxx rather than sm_xxx.
Re-added the option to not pad items, as padded items look wrong on the
RiscPC.
Changed MakeMod so that 'Larger' is used as the pinboard task if
'Pinboard' isn't running. Don't know whether this works though, as I
don't use Larger...
4.20 19 Aug 1994
Can sort according to the current Filer option (stored in the CMOS ram),
or by name, type, size or date, or even no sorting ar all. The only
problem is that the filer dates applications' by their !RunImage, which
TreeMenu doesn't do (yet). The sorting is sometimes slightly different
from the Filer's for image directories which TreeMenu puts with normal
directories, but the Filer treats as files. I'll change this if anyone
is bothered by it...
Removed the options to sort NFS and longfilenames; all directories are
sorted according to 'Choices'.
Stopped Adjust click on iconbar icons opening the Info...Quit menu.
Added options to change the pointer shape when over treemenu icons, and
also to make iconbar icons have a 'menu' button type. These aren't much
use...
Made TreeMenu prepend each chosen path to the system variable 'TreeMenuHistory$Path'. Hence you can put 'TreeMenuHistory:#' into an icon's menu specification to get easy access to the last few choices made with TreeMenu. Sys vars have limited length (<256), so this will only store a few past choices.
Added another item in 'Choices' which specifies an extra distance to the
left that menus are opened at. TreeMenus normally have sprites on the
left, so the normal 64 OS units is not really enough.
Made error parent items not occasionaly have submenu arrows.
Made all menu titles indirected, so that they can be longer than 10 chrs.
Changed the implemention of history. You set the size of an internal
buffer in Choices, and TreeMenu uses this buffer whenever you put
'TreeMenuHistory:' in a menu specification. This was done because the
256 chr limit for system variables was quite a limitation.
Improved icons in mutiple-path menus, eg. '@', '<...>', '...:' have
disc-drive icons.
4.21 24 Aug 1994
Made the titlebar menu be configurable. Put '%s#*' to include the
titlebar filename. (Yep, I'm using sprintf( ...)).
4.22 27 Aug 1994
Fixed a bug which sometimes displayed archives as file_000
Added support for adjust clicks on NFS filer icons on the iconbar.
4.23 07 Sep 1994
Made small_xxx be looked for even for filerpatch-style display...
Fixed bug in MakeMod where drive clicks weren't checked for being on the
iconbar.
4.24 12 Sep 1994
Seem to be sent bogus clicks sometimes with window handle = 0, when an
icon is cliked on just as TreeMenu is starting. Now detect this and